/*
 * @Author: AskMeWhy
 * @Date: 2020-12-03 09:51:52
 * @Last Modified by: AskMeWhy
 * @Last Modified time: 2021-10-18 14:20:10
 */
import type { App } from 'vue';
import { askPlus, askMinus, askTimes, askDiv } from "@/utils";
import VueExtensions from "./extensions";
import VueDirectives from "./directives/";
import VueComponents from "./components";
import VueUseLib from "./lib";
export default {
    install: (app: App) => {
        VueExtensions(app);
        VueDirectives(app);
        VueComponents(app);
        VueUseLib(app);
    }
};
Number.prototype.$plus = function(num) {
    return askPlus(Number(this), num);
};
Number.prototype.$minus = function(num) {
    return askMinus(Number(this), num);
};
Number.prototype.$times = function(num) {
    return askTimes(Number(this), num);
};
Number.prototype.$div = function(num) {
    return askDiv(Number(this), num);
};
String.prototype.$plus = function(num: string) {
    if (isNaN(Number(this)) || isNaN(Number(num))) {
        throw Error("String.$plus的值不是合法数值: " + num);
    }
    return String(askPlus(Number(this), num));
};
String.prototype.$minus = function(num: string) {
    if (isNaN(Number(this)) || isNaN(Number(num))) {
        throw Error("String.$minus的值不是合法数值: " + num);
    }
    return String(askMinus(Number(this), num));
};
String.prototype.$times = function(num: string) {
    if (isNaN(Number(this)) || isNaN(Number(num))) {
        throw Error("String.$times的值不是合法数值: " + num);
    }
    return String(askTimes(Number(this), num));
};
String.prototype.$div = function(num: string) {
    if (isNaN(Number(this)) || isNaN(Number(num))) {
        throw Error("String.$div的值不是合法数值: " + num);
    }
    return String(askDiv(Number(this), num));
};
